import {
    get,
    post
} from '../utils/request.js';
import axios from 'axios'

let preUrl = process.env.VUE_APP_BASE_API

/* 登录注册 */
export const login = (params) => post('/b/privs/login', params);

export const getCode = (params) => axios.get(preUrl+'/b/privs/vc?t='+params,{
  responseType: "blob",
  headers: {
    "Content-Type": "application/json",
  }
});

/* 退出登录 */
export const logout = (params) => post('/b/privs/logout', params);
/* 统一退出登录 */
export const pcLoginOut = (params) => post('/b/privs/pcLogout', params);

/* ca退出登录 */
export const caLoginOut = (params) => post('/b/privs/caLogout', params);

/* CA登录 */
export const caLogin = (params) => post('/b/privs/caLogin', params);

/* 统一用户登录 */
export const tyLogin = (params) => post('/b/privs/tyLogin', params);

/* 修改密码 */
export const changePw = (params) => post('/b/privs/user/changePw', params);

/* 获取二维码 */
export const getErCode = (params) => post('/b/privs/erCode', params);//获取二维码

/* 获取扫码状态 */
export const getErCodeResult = (params) => post('/b/privs/erCodeResult', params);//获取二维码请求结果

/* ca用户注册 */
export const getUserCode = (params) => post('/b/privs/getUserCode', params);

/* 参数加密 */
//开发环境
/* export const addXml = (params) =>{
  return axios.post('http://192.168.2.100/xml/addXml', params, {
      'Content-Type':'application/x-www-form-urlencoded'
  })
} */
//生产环境
export const addXml = (params) =>{
    return axios.post('/xml/addXml', params, {
        'Content-Type':'application/x-www-form-urlencoded'
    })
  }
/* 参数解密 */
//开发环境
//export const cutXml = (params) => axios.get('http://192.168.2.100/xml/cutXml?type='+params);
//生产环境
export const cutXml = (params) => axios.get('/xml/cutXml?type='+params);

/* 证书 */
//开发环境
//export const getCert = (params) => axios.get('http://192.168.2.100/xml/getCert');
//生产环境
export const getCert = (params) => axios.get('/xml/getCert');